package io.github.huanyv.ui;

import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import io.github.huanyv.util.Constant;
import io.github.huanyv.util.SimpleConfigUtil;

import javax.swing.*;
import java.awt.*;

/**
 * @author huanyv
 * @date 2025/7/24 20:46
 */
public class TotalCmdSettingUI {
    private JTextField totalCmdPath;
    private JPanel panel;
    private JComboBox openPanel;
    private JCheckBox newTab;

    public JTextField getTotalCmdPath() {
        return totalCmdPath;
    }

    public JComboBox getOpenPanel() {
        return openPanel;
    }

    public JCheckBox getNewTab() {
        return newTab;
    }

    public JPanel getPanel() {
        String path = SimpleConfigUtil.getString(Constant.TOTAL_CMD_PATH_SETTING);
        totalCmdPath.setText(path);
        String panelLocation = SimpleConfigUtil.getString(Constant.PANEL_LOCATION);
        openPanel.setSelectedItem(panelLocation);
        return panel;
    }

    {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        final JPanel panel1 = new JPanel();
        panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
        final JToolBar.Separator toolBar$Separator1 = new JToolBar.Separator();
        panel1.add(toolBar$Separator1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
        panel = new JPanel();
        panel.setLayout(new GridLayoutManager(3, 4, new Insets(0, 0, 0, 0), -1, -1));
        panel.setToolTipText("");
        panel1.add(panel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        final JLabel label1 = new JLabel();
        label1.setText("TC Path:");
        panel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
        final Spacer spacer1 = new Spacer();
        panel.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
        totalCmdPath = new JTextField();
        totalCmdPath.setText("");
        totalCmdPath.setToolTipText("TotalCmd EXE Path");
        panel.add(totalCmdPath, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
        final JLabel label2 = new JLabel();
        label2.setText("Panel:");
        panel.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
        openPanel = new JComboBox();
        openPanel.setEditable(false);
        final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
        defaultComboBoxModel1.addElement("Right");
        defaultComboBoxModel1.addElement("Left");
        openPanel.setModel(defaultComboBoxModel1);
        openPanel.setToolTipText("123");
        openPanel.putClientProperty("html.disable", Boolean.FALSE);
        panel.add(openPanel, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    }
}
